/*
 * UDPSocket.h
 *
 *  Created on: 20/06/2014
 *      Author: Vitor
 */

#ifndef UDPSOCKET_H_
#define UDPSOCKET_H_

#include "SDL2/SDL_net.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <string>

struct UDPPacket {
	unsigned int host_ip;
	unsigned short port;
	std::vector<char> bytes;
};

class UDPSocket {
private:
	UDPsocket socket;

public:
	UDPSocket(short port);
	virtual ~UDPSocket();

	void send(const std::vector<char>& bytes, std::string ip_address,
			short port);
	bool recv(int max_size, UDPPacket& storing_packet);
};

#endif /* UDPSOCKET_H_ */
